package com.zhaochao.gecco.zj;

import com.geccocrawler.gecco.annotation.PipelineName;
import com.geccocrawler.gecco.pipeline.Pipeline;

import java.io.*;


@PipelineName("zjNewsDetailPipeline")
public class ZJNewsDetailPipeline implements Pipeline<ZJNewsDetail> {
   static BufferedWriter bw =null;
    static {
        try {
            bw= new BufferedWriter(new OutputStreamWriter(new FileOutputStream("title.txt"),"UTF-8"));
        }catch (Exception e){
            e.printStackTrace();
        }

    }
    public void process(ZJNewsDetail zjNewsDetail) {
        try{
            System.out.println(zjNewsDetail.getTitle()+"  "+zjNewsDetail.getCreateTime());
            bw.newLine();
            bw.write(zjNewsDetail.getTitle());
            bw.flush();
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
